home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / doors_2 / ytbeta2c.zip / LOCAL.BAS < prev    next >
BASIC Source File  |  1990-04-04  |  4KB  |  149 lines

  1.  
  2.  
  3. Rem //* Local logon program for Yankee Trader v1.0 \\*
  4. rem //* Copyright 1990 by Alan Davenport \\*
  5. Rem //* For QuickBasic 3.0 \\*
  6.  
  7. color 14
  8. cls
  9. dim users$(500)
  10. users$ = command$    'take user number from command line input
  11.  
  12. print
  13. print "Yankee Trader Local Logon Program v1.0
  14. print "Copyright 1990 by Alan Davenport
  15. print
  16.  
  17.  
  18. open "local.dat" as 1 len = 40
  19. field #1,40 as local$
  20.  
  21. if lof(1) <> 0 then
  22.    for r = 1 to lof(1) / 40
  23.        get 1,r
  24.        users$(r) = local$
  25.    next r
  26. end if
  27.  
  28. display.list:
  29.  
  30. if users$(1) <> "" then   'display list if no command line input
  31.  
  32.    if users$ = "" then
  33.       for r = 1 to lof(1) / 40
  34.       if users$(r) = "" then exit for
  35.       print str$(r);"]",users$(r)
  36.       if (r mod 15) = 0 then
  37.          print "[Pause]";
  38.          while inkey$= ""
  39.          wend
  40.          cls
  41.          print
  42.       end if
  43.       next r
  44.       print
  45.       print "Enter user number, press [ENTER] for NEW or LIST. -=> ";
  46.       line input a$
  47.       if a$ = "list" or a$ = "LIST" then goto display.list
  48.       num = val(a$)
  49.    else
  50.       num = val(users$)      'take user number from command line input
  51.       users$ = ""
  52.    end if
  53.    if users$(num) = "" and num <> 0 then goto display.list
  54.    player$ = users$(num)
  55.  
  56. end if
  57.  
  58.  
  59. if player$ = "" then
  60. enter.new.player:
  61.    print
  62.    print
  63.    print "Enter your name please or press [ENTER] to quit. -=> ";
  64.    line input player$
  65.    if player$ = "" then
  66.       close
  67.       print
  68.       print "Aborted!"
  69.       end
  70.    end if
  71.    print
  72.    print chr$(34);player$;chr$(34);" ";
  73.    print "is this ok? (Y/n) ";
  74.    line input a$
  75.    if a$ = "n" or a$ = "N" then goto enter.new.player
  76.    lset local$ = player$
  77.    put 1,lof(1) / 40 + 1
  78. end if
  79.  
  80. close
  81.  
  82. Rem //* Massage player$ \\*
  83.  
  84. 'strip leading spaces
  85.  
  86. while left$(player$,1) = " "
  87.       player$ = right$(player$,len(player$) - 1)
  88. wend
  89.  
  90. 'strip trailing spaces
  91.  
  92. while right$(player$,1) = " "
  93.       player$ = left$(player$,len(player$) - 1)
  94. wend
  95.  
  96. 'strip imbedded double spaces
  97.  
  98. while instr(player$,"  ")
  99.       x = instr(player$,"  ")
  100.       player$ = left$(player$,x -1) + right$(player$,len(player$) - x)
  101. wend
  102.  
  103. 'turn to all upper case
  104.  
  105. for r = 1 to len(player$)
  106.     a$ = mid$(player$,r,1)
  107.     if a$ => "a" and a$ <= "z" then mid$(player$,r,1) = chr$(asc(a$) and 223)
  108. next r
  109.  
  110. 'split off first and last names
  111.  
  112. first$ = left$(player$,instr(player$ + " "," ") - 1)
  113.  
  114. if len(first$) <> len(player$) then    'needed to deal with single name names
  115.    last$ = right$(player$,len(player$) - len(first$) - 1)
  116. end if
  117.  
  118.  
  119.  
  120. '//* OK, create a DORINFO1.DEF and run Yankee Trader \\*
  121.  
  122. print
  123. print "Loading...
  124.  
  125. open "DORINFO1.DEF" for output as 1
  126.  
  127. Print #1,"Yankee Trader Local Logon Program"   'bbs name
  128. print #1,"Alan"                                'sysop first name
  129. print #1,"Davenport"                           'sysop last name
  130. print #1,"COM0                                 'com port  (0 = local)
  131. print #1,"0 BAUD,N,8,1                         'baud rate (0 = local)
  132. print #1,0                                     'multi tasker type
  133. print #1,first$                                'user first name
  134. print #1,last$                                 'user last name
  135. Print #1,"Anytown, USA"                        'user city/state
  136. print #1,1                                     'graphics yes/no
  137. print #1,100                                   'user security level
  138. print #1,45                                    'user time limit
  139. print #1,0                                     'fossil yes/no
  140.  
  141. close
  142.  
  143. shell "YT.EXE DORINFO1.DEF"
  144.  
  145. locate 25,1   'cursor to screen bottom
  146.  
  147. end
  148.  
  149.